package com.liaoyoule.multiple;

import com.liaoyoule.multiple.dao.constant.DatasourceConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.net.UnknownHostException;

/**
 * Created by cdyoue on 2017/1/23.
 */
@SpringBootApplication
@EnableSwagger2
@EnableConfigurationProperties(DatasourceConstant.class)
@EnableAutoConfiguration
@ServletComponentScan // 扫描使用注解方式的servlet
@ComponentScan(basePackages = "com.liaoyoule.multiple")
public class ReststartApp extends SpringBootServletInitializer {
    private static final Logger log = LoggerFactory.getLogger(ReststartApp.class);
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ReststartApp.class);//这里是@SpringBootApplication类
    }

    public static void main(String[] args) throws UnknownHostException {
        SpringApplication.run(ReststartApp.class,args);
    }
}
